import requests
import time,json

def get_urls(index):
    print('这是第%d页'%(index/10))
    url = 'https://spa1.scrape.center/api/movie/?limit=10&offset=' + f'{index}'
    resp = requests.get(url)
    html = resp.content.decode('utf8')
    html = json.loads(html)

    return html

def parse_html(html):
    info = html["results"]
    
    for item in info:
        id = item['id'],
        name = item['name'],
        alias = item['alias']
        cover_img = item['cover'],
        categories = item['categories']
        published_at = item['published_at'],
        minute = item['minute']
        score = item['score'],
        regions = item['regions']

        data = {
            'id':id,'name':name,'alisa':alias,'cover_img':cover_img,\
            'categories':categories,'published_at':published_at,'minute':minute, \
            'score':score,'regions':regions
        }

        print(data)

if __name__ == '__main__':
    for index in range(0,91,10):
        html = get_urls(index)
        parse_html(html)
        